package com.tanhua.server.controller;

import com.tanhua.domain.db.UserInfo;
import com.tanhua.server.interceptor.UserThreadLocal;
import com.tanhua.server.service.UserInfoService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("users")
public class UserInfoController {

    @Autowired
    private UserInfoService infoService;

    @GetMapping
    public ResponseEntity<UserInfo> queryUserInfo(@RequestParam(value = "userID", required = false) String userID,
                                                  @RequestParam(value = "huanxinID", required = false) String huanxinID) {
        return infoService.queryUserInfo(userID, huanxinID);
    }

    @PutMapping
    public ResponseEntity<Void> updateUserInfo(@RequestBody UserInfo userInfo){
        return infoService.updateUserInfo(userInfo);
    }
}
